/**
 * @file lv_multilingual.h
 *
 */

#ifndef LV_MULTILINGUAL_H
#define LV_MULTILINGUAL_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/
#ifdef SUPPORT_EX_PREINCLUDE /*get SUPPORT_TMENU or SUPPORT_MULTILINGUAL */
  #include "Preinclude.h"
#endif

/*********************
 *      DEFINES
 *********************/
#if !defined(SUPPORT_TMENU) && !defined(SUPPORT_MULTILINGUAL) /*Redefinition*/
#include "lv_conf.h"
#if defined(LV_MULTILINGUAL_ENUM)  /* enum char ary */

/*Number of supported languages*/
#ifndef LV_MULTILINGUAL_ENUM_COUNT
  #define LV_MULTILINGUAL_ENUM_COUNT   2
#endif

/*The currently selected multiple languages*/
#ifndef LV_MULTILINGUAL_ENUM_SEL
  extern unsigned char lv_multilingual_sel;
  #define LV_MULTILINGUAL_ENUM_SEL  lv_multilingual_sel
#endif

#endif //defined(LV_MULTILINGUAL_ENUM)
#endif  /* defined(SUPPORT_TMENU) or defined(SUPPORT_MULTILINGUAL) */
/**********************
 *      TYPEDEFS
 **********************/

/**********************
 * GLOBAL PROTOTYPES
 **********************/
#if !defined(SUPPORT_TMENU) && !defined(SUPPORT_MULTILINGUAL) /*Redefinition*/

#if defined(LV_MULTILINGUAL_RESOURCE)  /* Defined by user resource files */

  /* Definition of multilingual types */
  #define lv_multilingual_t   unsigned char
  /* Multilingual character conversion function implemented by users*/
  const char * lv_multilingual_to_char(lv_multilingual_t *code);

#elif defined(LV_MULTILINGUAL_ENUM)  /* enum char ary */

/* Definition of multilingual types */
typedef struct{
  const char const *lan[LV_MULTILINGUAL_ENUM_COUNT];
}lv_multilingual_t;
/* Multilingual character conversion function */
/*prototype: const char * lv_multilingual_to_char(lv_multilingual_t *code);*/
#define lv_multilingual_to_char(code) ((code)->lan[LV_MULTILINGUAL_ENUM_SEL])

#else /* Single language support *

/* Definition of multilingual types */
#define lv_multilingual_t   char
/* Multilingual character conversion function */
/*prototype: const char * lv_multilingual_to_char(lv_multilingual_t *code);*/
#define lv_multilingual_to_char(code) (code)

#endif
#endif  /* defined(SUPPORT_TMENU) or defined(SUPPORT_MULTILINGUAL) */
/**********************
 *      MACROS
 **********************/
/*Use compatibility definition, here macro escape is used*/
#if defined(SUPPORT_TMENU)

#include "TMenuCfg.h"  /*TMenu system global config file*/
#include "TMenuMember_Lan.h" /*local: TGUI/Source/TMenu/Portable/ */
/* Definition of multilingual types */
#define lv_multilingual_t   LanCode_t
/* Multilingual character conversion function */
/*prototype: const char * lv_multilingual_to_char(lv_multilingual_t *code);*/
#define lv_multilingual_to_char(code) pLanCodeToChar(code)

#elif defined(SUPPORT_MULTILINGUAL)

  #include "Multilingual.h" /*local: CompGUI/Multilingual */
  /* Definition of multilingual types */
  #define lv_multilingual_t   Multilingual_t
  /* Multilingual character conversion function */
  /*prototype: const char * lv_multilingual_to_char(lv_multilingual_t *code);*/
  #define lv_multilingual_to_char(code) Multilingual_ToChar(code)

#endif

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*LV_MULTILINGUAL_H*/
